{% extends 'layout.html' %}
{% set active_page = 'index' %}
{% block style %}
    <link href="//cdn.bootcss.com/bootstrap-datetimepicker/4.14.30/css/bootstrap-datetimepicker.min.css"
          rel="stylesheet">

    <link href="{{ url_for('static', filename='css/note_add.css') }}" rel="stylesheet"/>
{% endblock %}

{% block title %}添加记录{% endblock %}
{% block content %}
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-heading"><h4>添加记录</h4></div>

                <!-- 表单内容 -->
                <div class="panel-body">
                    <div class="row">
                        <div class="col-md-12">
                            <form class="form-horizontal" role="form" action="" method="post">
                                {{ form.hidden_tag() }}
                                <div class="form-group">
                                    <label class="col-md-2 control-label">日期</label>

                                    <div class="col-md-5">
                                        <div class='input-group date' id='datetimepicker1'
                                             data-date-format="yyyy-mm-dd">
                                            <input name="date" type='text' class="form-control"
                                                   value="{{ form.date.data}}"/>
                                            <span class="input-group-addon">
                                                <span class="glyphicon glyphicon-calendar"></span>
                                            </span>
                                        </div>
                                    </div>
                                    <span class="col-md-5 text-danger">
                                        {% for error in form.date.errors %}
                                            * {{ error }}<br/>
                                        {% endfor %}
                                    </span>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-2 control-label">内容</label>

                                    <div class="col-md-5">
                                        <input name="content" class="form-control"
                                               type="text" maxlength="120"
                                               value="{{ form.content.data }}">
                                    </div>
                                    <span class="col-md-5 text-danger">
                                        {% for error in form.content.errors %}
                                            * {{ error }}<br/>
                                        {% endfor %}
                                    </span>
                                </div>

                                <div class="form-group">
                                    <label class="col-md-2 control-label">备注</label>

                                    <div class="col-md-5">
                                        <textarea name="remark" class="form-control"
                                                  rows="6" maxlength="140"
                                                >{{ form.remark.data }}</textarea>
                                    </div>
                                    <span class="col-md-5 text-danger">
                                        {% for error in form.remark.errors %}
                                            * {{ error }}<br/>
                                        {% endfor %}
                                    </span>
                                </div>

                                <div class="form-group">
                                    <div class="col-md-offset-2 col-md-5">
                                        <button type="submit" class="btn btn-default">保存
                                        </button>
                                        <a href="/" class="col-md-offset-1 btn btn-primary">返回</a>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <!-- 表单内容 end -->
            </div>
        </div>
    </div>
{% endblock %}

{% block script %}
    {{ super() }}
    <script src="//cdn.bootcss.com/moment.js/2.10.3/moment.min.js"></script>
    <script src="//cdn.bootcss.com/bootstrap-datetimepicker/4.14.30/js/bootstrap-datetimepicker.min.js"></script>
    <script src="//cdn.bootcss.com/bootstrap-datetimepicker/2.1.30/js/locales/bootstrap-datetimepicker.zh-CN.js"
            charset="UTF-8"></script>
    <script src="{{ url_for('static', filename='js/note_add.js') }}"></script>
{% endblock %}

